<!DOCTYPE html>
<html>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<title>doh.robot MVC shipto-billto-hierarchical Test</title>

		<style>
			@import "../../../../../util/doh/robot/robot.css";
		</style>

		<!-- required: dojo.js -->
		<script type="text/javascript" src="../../../../../dojo/dojo.js"
			djConfig="isDebug: true, parseOnLoad: true"></script>

		<script type="text/javascript" src="../helpers.js"></script>

		<script type="text/javascript">
			dojo.require("dijit.robotx");

			dojo.addOnLoad(function(){
				doh.robot.initRobot('../test_mvc_shipto-billto-hierarchical.html');

				doh.register("test_MVC_SimpleDataBoundField", [
				{
						name: "initial conditions",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();
							console.debug("dojo.version() is "+dojo.version);
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("ShipTo", dijit.byId("addrLabel").get('value'));
								doh.is("123 Valley Rd", dijit.byId("streetInput").get('value'),"streetInput should be set");
							}), 1000);
							return d;
						}
					 },
					 {
						name: "billto",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();
							
							doh.robot.mouseMoveAt("dijit_form_Button_1", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("BillTo", dijit.byId("addrLabel").get('value'),"addrLabel should be set");
							}), 1000);
							return d;
						}
					},
					{
						name: "shipto",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();
							doh.robot.mouseMoveAt("dijit_form_Button_0", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("ShipTo", dijit.byId("addrLabel").get('value'),"addrLabel should be set");
							}), 1000);
							return d;
						}
					},
					{
						name: "changeShipToAddress",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();
							
							//reset the streetInput textbox
							//dijit.byId("streetInput").set('value',"");
							
							doh.robot.mouseMoveAt("addrLabel", 500, 0);
							doh.robot.mouseClick({left:true}, 500);

							doh.robot.keyPress(dojo.keys.TAB, 500, {});
							doh.robot.keyPress(dojo.keys.TAB, 500, {});
							doh.robot.keyPress(dojo.keys.DELETE, 500, {});
							
							doh.robot.typeKeys("456 Mountain Rd", 500, 1000);
							
							doh.robot.mouseMoveAt("dijit_form_Button_1_label", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.mouseMoveAt("dijit_form_Button_0_label", 500, 0);
							doh.robot.mouseClick({left:true}, 500);

							doh.robot.mouseMoveAt("streetInput", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("456 Mountain Rd", dijit.byId("streetInput").get('value'),"streetInput should be set");
							}), 1000);
							return d;
						}
					}
				]);
				doh.run();
			});
		</script>
</html>
